home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 2 / Amiga Tools 2.iso / tools / packer / uout / uout.doc < prev    next >
Text File  |  1995-03-09  |  6KB  |  119 lines

  1.                           Uuencode Out 1.1
  2.                           by Roland Acton
  3.  
  4.   A number of Internet (Usenet) newsgroups allow the posting of
  5. uuencoded binary files. Since some systems have limits (imposed by
  6. their hardware or software) on the lengths of posted articles, these
  7. uuencoded files are typically split up into sections of about 60K,
  8. each of which are sent out as separate posts.
  9.   Many newsreaders have the ability to extract the uuencoded data
  10. from these posts and use it to recreate the original file. If yours
  11. doesn't, or it doesn't work, you have a problem. You may have to
  12. download the files and join them together yourself. This isn't as
  13. easy as it sounds. The posts typically contain message headers,
  14. comments by the poster, and the like which will confuse your
  15. uudecode program. This extranous information must be edited out by
  16. hand, which is tedious.
  17.   UOut was written to deal with this problem. It will take the
  18. separate files, join them together (stripping out all non-uucode
  19. data in the process), call your uudecode program on the resulting
  20. file, and then delete the uucode files.
  21.   This program was written as an example program for the Struct
  22. compiler, and is being distributed both with it and as a stand-alone
  23. archive. If you have the stand-alone version, just copy the UOut
  24. program into your C: directory. If you have the Struct archive, all
  25. that's included is the source code. Set up the compiler as described
  26. in the documentation, then compile and link the UOut program and
  27. place the object code into your C: directory.
  28.   You'll need to have a uudecode program in your C: directory as
  29. well. Any standard one should work.
  30.   UOut expects to find the uucoded files in the current directory
  31. with names like this:
  32.  
  33. <file-list-prefix>.01
  34. <file-list-prefix>.02
  35. <file-list-prefix>.03
  36.      .........
  37.  
  38.   For example:
  39.  
  40. Belldandy.01
  41. Belldandy.02
  42. Belldandy.03
  43. Belldandy.04
  44.  
  45.   To decode the example, you would type:
  46.  
  47. UOut Belldandy
  48.  
  49.   UOut will create a temporary file called "uotBelldandy" in the
  50. current directory, place all the important information from the
  51. original files in it, call the uudecode program on the temporary
  52. file, and then delete the temporary file and the originals. The
  53. binary file contained in the "Belldandy" posts will be left in the
  54. current directory.
  55.   A potential problem with UOut is that it doesn't really understand
  56. the data it's processing - it's just a joiner, not an actual
  57. decoder. It will report an error and stop if it sees something in
  58. the data that it can't deal with, but there may be files out there
  59. that will slip past its checks and be decoded wrongly. (Read the How
  60. It Works section, below, to understand this better)
  61.   Another problem is that UOut has no idea if the uudecode program
  62. was actually able to decode the file. If there's an error during
  63. decoding (disk full is most likely), and UOut hasn't detected
  64. anything wrong, the source files will be deleted. Always make
  65. backups of important uucoded files.
  66.  If a decoded file seems wrong in some way, restore the uucoded
  67. files from backups (or redownload them) and run UOut on them again.
  68. Use a text editor to look at the temporary file during the decoding
  69. phase. If something is obviously wrong with it, you'll have to join
  70. the files together manually. If everything looks fine, it's possible
  71. that the file was corrupted at some point before UOut ever got to
  72. it.
  73.  
  74. HOW IT WORKS
  75. ------------
  76.   The basic idea behind the program is that each of the separate
  77. files have the same fundamental structure:
  78.  
  79.   <irrelevant header>
  80.   <uuencoded data>
  81.   <irrelevant trailer>
  82.  
  83.   The header includes such things as the Net mail system's
  84. information about on the post, comments from the poster, and maybe
  85. even a shell script joiner/decoder that couldn't be used for some
  86. reason. The trailer may include plaintext information about the
  87. uuencoding or splitting, extra return characters, or null
  88. characters inadvertently appended to the file at some point along
  89. the line. None of this is necessary or useful to the uudecode
  90. program, so it must be removed.
  91.   UOut has a variable, COPYSTATUS, which is set to zero when a file
  92. is first opened for reading. While the program is in the header
  93. section, COPYSTATUS remains zero, and all data brought in from the
  94. file is discarded instead of being written to the temporary file.
  95. When the program believes that it has found the beginning of the
  96. uuencoded data, COPYSTATUS is set to one and all further lines of
  97. data are redirected to the temporary file.
  98.   The program has several ways of determining when it has passed the
  99. header and reached the uuencoding. It primarily uses the fact that
  100. uuencoded data takes up exactly 62 columns, and assumes that five of
  101. these lines in a row means that it has found the uuencoding.
  102. (Interestingly, I found one or two cases where *63* columns were
  103. used, and when the files were joined manually, the output binary
  104. worked! Perhaps the 62 columns are only a convention and not a
  105. restriction...?)
  106.   Additionally, it knows that the data in the first file must start
  107. with "begin", and that many encoding programs use the word "BEGIN"
  108. in uppercase to mark the start of a segment.
  109.   To find the end of the uuencoded data, UOut looks for a line that
  110. is not 62 columns (which means the end of the current segment) or a
  111. line that has the word "end" all by itself, possibly preceded by a
  112. line less than 62 columns. It also knows that many programs mark the
  113. end of a segment with "END" in uppercase.
  114.   At this point, since there is nothing else of value in the file,
  115. UOut simply closes it and goes on to the next one in the sequence.
  116. It expects that the file containing "end" is the last one in the
  117. sequence, and will report an error if there are more files after it
  118. or "end" is never found at all.
  119.